package com.logos.stream;

import java.util.*;
import java.util.stream.Stream;

public class test01 {

    public static void main(String[] args) {
        // 1. 单列集合获取Stream流
        List<String> list = new ArrayList<>();
        Collections.addAll(list, "a", "b", "c", "d", "e");
        Stream<String> stream = list.stream();
        stream.forEach(System.out::println);

        // 2. 双列集合获取Stream流
        HashMap<String, Integer> map = new HashMap<>();
        map.put("a", 1);
        map.put("b", 2);
        map.put("c", 3);
        map.put("d", 4);
        map.keySet().stream().forEach(System.out::println);
        map.entrySet().stream().forEach(System.out::println);

        // 3. 数组获取Stream流
        int[] arr = {1, 2, 3, 4, 5};
        Arrays.stream(arr).forEach(System.out::println);
    }
}
